<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Database extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users',function ($table){
            $table->string('id',32)->unique();
            $table->string('user_name',128)->unique();
            $table->string('password',128);
            $table->string('nick_name',128);
            $table->string('created_at',25);
            $table->string('updated_at',25);
        });

        Schema::create('friends',function ($table){
            $table->string('user_id',32);
            $table->string('friend_id',32);
            $table->string('created_at',25);
            $table->string('updated_at',25);
        });

        Schema::create('group',function ($table){
            $table->string('id',32)->unique();
            $table->string('name',128);
            $table->string('created_at',25);
            $table->string('updated_at',25);
        });

        Schema::create('token',function ($table){
            $table->string('token')->unique();
            $table->string('user_id',32);
            $table->string('created_at',25);
            $table->string('updated_at',25);
        });

        Schema::create('user_group',function ($table){
            $table->string('group_id',32);
            $table->string('user_id',32);
            $table->string('created_at',25);
            $table->string('updated_at',25);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('friends');
        Schema::dropIfExists('group');
        Schema::dropIfExists('token');
        Schema::dropIfExists('user_group');
        Schema::dropIfExists('users');
    }
}
